{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}

{% block title %}策略模拟回测-首页{% endblock %}
{% block navbar %}
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
          <!-- The mobile navbar-toggle button can be safely removed since you do not need it in a non-responsive implementation -->
          <a class="navbar-brand" href="/">策略模拟回测</a>
        </div>
        <!-- Note that the .navbar-collapse and .collapse classes have been removed from the #navbar -->
        <div id="navbar">
          <ul class="nav navbar-nav">
            <li class="active"><a href="/">首页</a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">当前登录用户：{{current_user}}</a></li>
            <li><a href="{{url_for('logout', _external=True)}}">登出</a></li>
          </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>
<link href="/static/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/static/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
{% endblock %}

{% block page_content %}
	<div class="page-content">

        <p>&nbsp;</p>
        <p>&nbsp;</p>

        {% for message in get_flashed_messages(with_categories=True) %}
            <div class="alert alert-{{ message[0] }}">
                {{ message[1] }}
            </div>
        {% endfor %}
        </div>

        <p><h4 align="center"><b>全部策略一览</b></h4></p>
        <p><h4> 目前共有 {{ strategy_count }} 个策略记录：</h4></p>
            {% if strategy_list %}
            <p>
            <hr size="2" />
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>策略名称</th>
                        <th>手续费率</th>
                        <th>起始资金</th>
                        <th>起始日期</th>
                        <th>结束日期</th>
                    </tr>
                </thead>
                <tbody>
                    {% for strategy in strategy_list %}
                    <tr>
                        <td>{{ loop.index0 + 1 }}</td>
                        <td><a href="/strategy/{{ strategy.id }}">{{ strategy.title }}</a></td>
                        <td>{{ strategy.fee_rate }}</td>
                        <td>{{ "{:,}".format(strategy.init_cash) }}</td>
                        <td>{{ strategy.start_date }}</td>
                        <td>{{ strategy.end_date }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% endif %}

        <p> &nbsp;</p>
        <p><h4 align="center">新建策略</h4></p>
        <form action="/" method="post" class="form" role="form">
            {{ wtf.quick_form(form) }}
        </form>
    </div>

<script type="text/javascript" src="/static/js/jquery-1.8.3.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="/static/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
{% endblock %}
